package object;
import java.sql.*;
//作为抽象基类
public class Plant {
    private int plantId;
    private String plantName;
    private int growthLevel; // 假设成长度是一个整数
    private Timestamp lastInteractionTime; // 使用Timestamp来存储时间

    // 构造器、getter和setter方法
    public Plant(int plantId, String plantName, int growthLevel, Timestamp lastInteractionTime) {
        this.plantId = plantId;
        this.plantName = plantName;
        this.growthLevel = growthLevel;
        this.lastInteractionTime = lastInteractionTime;
    }
    public Plant(int growthLevel,String plantName,Timestamp now) {
        this.plantId=0;
        this.growthLevel = growthLevel;
        this.plantName = plantName;
        this.lastInteractionTime = now;
        plantId = 0;
    }

    public Timestamp getLastInteractionTime() {
        return lastInteractionTime;
    }

    public void setLastInteractionTime(Timestamp lastInteractionTime) {
        this.lastInteractionTime = lastInteractionTime;
    }

    public int getGrowthLevel() {
        return growthLevel;
    }

    public void setGrowthLevel(int growthLevel) {
        this.growthLevel = growthLevel;
    }

    public String getPlantName() {
        return plantName;
    }

    public void setPlantName(String plantName) {
        this.plantName = plantName;
    }

    public int getPlantId() {
        return plantId;
    }

    public void setPlantId(int plantId) {
        this.plantId = plantId;
    }

    @Override
    public String toString() {
        return "你的植物{" +
                "id:" + plantId +
                ", 名字是:" + plantName + '\'' +
                ", 生长等级:" + growthLevel/100 +
                ", 上次照看时间:" + lastInteractionTime +
                '}';
    }

}
